package com.itranswarp.learnjava.utils;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.itranswarp.learnjava.bean.User;

public class Token {
    private static final Map<String, User> tokenStore = new HashMap<String, User>();
    public static boolean validate(String token) {
        return tokenStore.get(token) != null;
    }
    public static String setToken(User user) {
        String token = UUID.randomUUID().toString();
        tokenStore.put(token, user);
        return token;
    }
}
